﻿using System;

namespace viNews.Classes
{
    /// <summary>
    /// The comment for the news
    /// </summary>
    public class Comment
    {
        private int _CommentId;
        /// <summary>
        /// The unique id of the comment
        /// </summary>
        public int CommentId
        {
            get { return _CommentId; }
            set { _CommentId = value; }
        }

        private int _NewsId;
        /// <summary>
        /// The id of the news this comment is posted to
        /// </summary>
        public int NewsId
        {
            get { return _NewsId; }
            set { _NewsId = value; }
        }

        private string _Author;
        /// <summary>
        /// The comment author
        /// </summary>
        public string Author
        {
            get { return _Author; }
            set { _Author = value; }
        }

        private string _Email;
        /// <summary>
        /// The comment author email
        /// </summary>
        public string Email
        {
            get { return _Email; }
            set { _Email = value; }
        }

        private string _Website;
        /// <summary>
        /// The comment author website
        /// </summary>
        public string Website
        {
            get
            {
                if (string.IsNullOrEmpty(_Website))
                    return null;
                else
                {
                    if (_Website.ToLower().StartsWith("http://"))
                        return _Website;
                    else
                        return "http://" + _Website;
                }
            }
            set { _Website = value; }
        }

        private DateTime _Date;
        /// <summary>
        /// The date comment is posted
        /// </summary>
        public DateTime Date
        {
            get { return _Date; }
            set { _Date = value; }
        }

        private string _Content;
        /// <summary>
        /// The comment actual contents
        /// </summary>
        public string Content
        {
            get { return _Content; }
            set { _Content = value; }
        }

        private bool _IsApproved;
        /// <summary>
        /// Wether the comment is approved
        /// </summary>
        public bool IsApproved
        {
            get { return _IsApproved; }
            set { _IsApproved = value; }
        }
    }
}
